package ws;


import org.apache.cxf.Bus;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CxfConfig {

    @Autowired
    Bus bus;

    @Autowired
    HelloWorldWsService helloWorldWsService;

    @Bean
    public ServletRegistrationBean wsServletConfig() {
        return new ServletRegistrationBean(new CXFServlet(), "/ws/*");
    }

//    @Bean
//    public Endpoint endpoint() {
//        EndpointImpl endpoint = new EndpointImpl(bus, helloWorldWsService);
//        endpoint.publish("/HelloWorld");
//        return endpoint;
//    }
//
//    private Endpoint formatEndpoint(String path, Object svc) {
//        QName serviceName=new QName("http://impl.webservice/","WeatherInterfaceImplService");
//        Service service= Service.create(url,serviceName);
//        EndpointImpl endpoint = new EndpointImpl(bus, svc ,serviceName);
//        endpoint.publish(path);
//        return endpoint;
//    }
}
